package com.hnxxxy.jfmgr.mapper;

import com.hnxxxy.common.redis.RedisMyabtisCstCache;
import com.hnxxxy.jfmgr.pojo.Jf_attachment;
import com.hnxxxy.jfmgr.pojo.Jf_conf;
import com.hnxxxy.jfmgr.pojo.Jf_detail;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @author：张浩东
 * @Phone：15096207164
 * @QQ：1367048164
 * @E-mail：1367048164@qq.com
 * @date:2020-05-19 16:33
 */

@Mapper
@CacheNamespace(implementation = RedisMyabtisCstCache.class)
public interface JfBackstageMapper {

    @Select("SELECT * FROM jf_conf WHERE superior = 0")
    List<Jf_conf> findAllJfConfFatherInfo();

    @Select("SELECT * FROM jf_conf WHERE superior = #{id}")
    List<Jf_conf> queryJfConfSonInfo(int id);

    @Select("SELECT * FROM jf_conf WHERE id = #{id}")
    Jf_conf queryJfConfPresentInfo(int id);

    @Insert(value = "INSERT INTO jf_detail(user_id, grade, status, certificate_type, certificate_type_pid, update_time,certificate_explain,numerical_interval,detailed_information,certificate_name,certificate_type_name) " +
            "VALUES (#{userId}, #{grade}, #{status}, #{certificateType}, #{certificateTypePid}, #{updateTime}, #{certificateExplain}, #{numericalInterval}, #{detailedInformation}, #{certificateName},#{certificateTypeName});")
    @Options(useGeneratedKeys = true, keyProperty = "id")
    int insertJfDetailCertificateInfo(Jf_detail jf_detail);

    @Insert(value = "INSERT INTO jf_attachment(user_id,image,jf_detail_id) VALUES (#{userId}, #{image},#{jfDetailId})")
    int insertJfAttachmentInfo(Jf_attachment jf_attachment);

}
